
// 基于准备好的dom，初始化echarts实例
var myChart = echarts.init(document.getElementById('projectProcess'))
var ecBoxY = ['项目启动','需求分析','标准规范编制','总体设计','软件开发','系统测试','系统部署及调试','培训','系统试运行','系统验收']
// 指定图表的配置项和数据
var option = {
    
    tooltip: {},
    legend: {
        data:['进度','计划'],
        itemWidth:20,
        itemHeight:10,
        textStyle:{
            color:"#fff"
        }
    },
    grid: {
        left: 100,
        right:10,
    },
    xAxis: {
        data: ['2019-08-20','2019-09-08','2019-09-20','2019-10-20','2019-10-20','2019-12-06','2019-12-16','2019-12-20','2019-12-24','2019-12-30'],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        },
        axisLabel:{
            interval:0,
        }
    },
    yAxis: {
        min:0,
        splitNumber: 10,
        axisLabel:{
            fontSize:10,
            margin: 2,
            formatter: function (value) {
                var texts = [];
                for(let i=0;i<ecBoxY.length;i++){
                    if(value == i){
                        texts.push(ecBoxY[i]);
                    }
                }
                return texts;
            }
        },
        axisLine:{
            interval:0,
            lineStyle:{
                color:"#fff",
                fontSize:12
            }
        },
        splitLine:{
            show:false
        }
        // data: ecBoxY
    },
    series: [
        {
            name: '进度',
            type: 'bar',
            barMaxWidth:12,
            data: [1,4,2,3,2,9],
            itemStyle: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0,
                    color: 'rgb(98,145,242)'
                  },
                    {
                      offset: 1,
                      color: 'rgb(10,41,190)'
                    }
                  ], false),
            }
        },
        {
            name: '计划',
            type: 'bar',
            barMaxWidth:12,
            data: [1,4,2,3,2,5,8,7,8,9],
            itemStyle: {
                normal: {
                  color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                    offset: 0,
                    color:  'rgb(47,230,252)'
                  },
                    {
                      offset: 1,
                      color:'rgb(40,97,214)'
                    }
                  ], false),
                  // color: function(params) {
                  //     var colorList = ['#0ec1ff', '#10cdff', '#12daff', '#15ebff', '#17f8ff', '#1cfffb', '#1dfff1'];
                  //     return colorList[params.dataIndex];
                  // }
                }
              },
        },
    ]
};

// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);

$('.map-info div ul li').click(function(){
    $(this).addClass("active").siblings().removeClass('active')
})